package server;

import java.io.Serializable;

public class Rule  implements Serializable {
	private static final long serialVersionUID = 3307454235662621656L;
	public Rule() {
		
	}
	
	public Rule(int index, String iprange, int port, permissionOpt permission) {
		type = typeOpt.IP;
		this.index = index;
		this.iprange = iprange;
		this.port = port;
		this.permission = permission;
	}
	
	public Rule(int index, int port, String protocol, permissionOpt permission) {
		type = typeOpt.CONTEXT;
		this.index = index;
		this.port = port;
		this.protocol = protocol;
		this.permission = permission;
	}
	
	public static enum typeOpt {IP, CONTEXT};
	public static enum permissionOpt {ALLOW, DENY};
	public int index;
	public typeOpt type;
	public String iprange;
	public int port;
	public String protocol;
	public permissionOpt permission;
}
